/*******************************************************************************
 * Copyright (c) 2013-2017 Lorenzo Bettini.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Lorenzo Bettini - Initial contribution and API
 *******************************************************************************/

/*
* generated by Xtext
*/
package org.eclipse.xsemantics.example.fj.ui.outline;

import org.eclipse.xsemantics.example.fj.fj.*;
import org.eclipse.xsemantics.example.fj.fj.Class;

import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider;
import org.eclipse.xtext.ui.editor.outline.impl.DocumentRootNode;

/**
 * customization of the default outline structure
 * 
 */
public class FJOutlineTreeProvider extends DefaultOutlineTreeProvider {
	protected void _createChildren(DocumentRootNode parentNode,
			Program program) {
		for (Class c : program.getClasses()) {
			createNode(parentNode, c);
		}
		if (program.getMain() != null)
			createNode(parentNode, program.getMain());
	}

	/**
	 * Don't show children of typed elements so to avoid showing the type of a
	 * field as a child (we're using our custom label provider anyway)
	 */
	protected boolean _isLeaf(TypedElement o) {
		return true;
	}

	protected boolean _isLeaf(Method o) {
		return true;
	}

	protected boolean _isLeaf(Expression o) {
		return true;
	}
}
